/*
 * Copyright [2010] [GP Software]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * DataHandlingException.java | Created on April 28, 2010
 */
package org.gp.gpetl.exception;

import org.gp.gpetl.handler.DataHandler;

/**
 * Exception class for data handling
 *
 * @author Paul Augustine C. Mendoza
 * @since 1.0
 */
public class DataHandlingException extends Exception {

    /**
     * The data handler
     */
    private DataHandler dataHandler;

    /**
     * Gets the data handler
     *
     * @return the data handler
     */
    public DataHandler getDataHandler() {
        return this.dataHandler;
    }

    /**
     * The constructor with data handler
     *
     * @param dataHandler the data handler
     */
    public DataHandlingException(DataHandler dataHandler) {
        super();
        this.dataHandler = dataHandler;
    }

    /**
     * The constructor with exception message and data handler
     *
     * @param message     the exception message
     * @param dataHandler the data handler
     */
    public DataHandlingException(String message, DataHandler dataHandler) {
        super(message);
        this.dataHandler = dataHandler;
    }

    /**
     * The constructor with exception message, cause and data handler
     *
     * @param message     the exception message
     * @param cause       the cause
     * @param dataHandler the data handler
     */
    public DataHandlingException(String message, Throwable cause,
                                 DataHandler dataHandler) {
        super(message, cause);
        this.dataHandler = dataHandler;
    }

    /**
     * The constructor with cause and data handler
     *
     * @param cause       the cause
     * @param dataHandler the data handler
     */
    public DataHandlingException(Throwable cause, DataHandler dataHandler) {
        super(cause);
        this.dataHandler = dataHandler;
    }
}
